<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header');
?>
<link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH;?>monthly_calendar.css"/>
<body> 
<table id="calendar" width='100%'>
	<tr id="calendar_header"><th colspan="7">
		<a href="index.php?m=calendar&c=calendar&t=<?php echo strtotime('-1 month', $timestamp);?>">&lt;</a>
		<?php echo date('F',$timestamp).' '.$year;?>
		<a href ="index.php?m=calendar&c=calendar&t=<?php echo strtotime('+1 month', $timestamp);?>">&gt;</a>
	</th></tr>
	<tr><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>
<?php 
	$current = 1;
	while($current <= $total_days){
		for($i = 0;$i < 7;	$i++){
			if(($current == 1 && $i < $first_day_of_month) || ($current > $total_days)){
				echo '<td class="empty">&nbsp</td>';
            	continue;				
			}
			echo '<td><a href="index.php?m=calendar&c=calendar&a=set_calendar&t='.mktime(0,0,0,$month,$current,$year).'">'.$current.'</a></td>';
			$current++;
		}	
		echo '</tr>';	
	}
?>	
</table>
</body>
</html>